package com.xujc.controller;

import com.opensymphony.xwork2.ActionSupport;
import com.xujc.dao.IFormDAO;
import com.xujc.entity.FormEntity;
import org.apache.struts2.interceptor.CookiesAware;

import java.util.List;
import java.util.Map;

/**
 * Created by xujc on 6/20/15.
 */
public class IndexAction extends ActionSupport implements CookiesAware{
    Map<String,String> mCookies;
    private IFormDAO mFormDAO;
    private List<FormEntity> mFormEntities;

    public List<FormEntity> getFormEntities() {
        return mFormEntities;
    }

    public void setFormEntities(List<FormEntity> formEntities) {
        mFormEntities = formEntities;
    }


    @Override
    public String execute() throws Exception {
        mFormEntities=mFormDAO.getAllForm();
        return SUCCESS;
    }

    public Map<String, String> getCookies() {
        return mCookies;
    }

    @Override
    public void setCookiesMap(Map<String, String> map) {
        mCookies=map;
    }

    public void setFormDAO(IFormDAO formDAO) {
        mFormDAO=formDAO;
    }
}
